<template>
  <div>
    <el-dialog
      title="提示"
      :visible.sync="dialogShow"
      width="30%"
      @open="open"
      :before-close="handleClose">
      <el-form :model="form" ref="pmsbrandFrom">

          
           <el-form-item label="品牌id" label-width="100px">
             <el-input v-model="form.brand_id"></el-input>
           </el-form-item>
          
           <el-form-item label="品牌名" label-width="100px">
             <el-input v-model="form.name"></el-input>
           </el-form-item>
          
           <el-form-item label="品牌logo地址" label-width="100px">
             <el-input v-model="form.logo"></el-input>
           </el-form-item>
          
           <el-form-item label="介绍" label-width="100px">
             <el-input v-model="form.descript"></el-input>
           </el-form-item>
          
           <el-form-item label="显示状态[0-不显示；1-显示]" label-width="100px">
             <el-input v-model="form.show_status"></el-input>
           </el-form-item>
          
           <el-form-item label="检索首字母" label-width="100px">
             <el-input v-model="form.first_letter"></el-input>
           </el-form-item>
          
           <el-form-item label="排序" label-width="100px">
             <el-input v-model="form.sort"></el-input>
           </el-form-item>
          
      </el-form>
      <el-row>
        <el-col :span="24" :push="8">
          <el-button @click="$emit('handler','close')">取 消</el-button>
          <el-button type="primary" @click="save">保 存</el-button>
        </el-col>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "pmsbrand-save",
  props:["dialogShow","pmsbrandFrom"],
  data() {
     return {
        form:{
        
            brand_id:0,
        
            name:'',
        
            logo:'',
        
            descript:'',
        
            show_status:0,
        
            first_letter:'',
        
            sort:0,
        
        }
     }
  },
  methods:{
    handleClose(){
      this.form={}
      this.$emit('handler','close')
    },
    save(){
      if (this.form.brand_id!=0 && this.pmsbrandFrom.brand_id!=undefined){
        //修改
        this.$emit("handler","update",this.form)
      }else {
        //新增
        this.$emit("handler","save",this.form)
      }
      this.handleClose()
    },
    open(){
      if (this.pmsbrandFrom.brand_id!=0 && this.pmsbrandFrom.brand_id!=undefined){
        //把新的数据赋值给form
        this.form=this.pmsbrandFrom
      }else {
        //新增
        this.form={}
      }
    }
  },
}
</script>

<style lang="less" scoped>

</style>
